package com.eascs.web.p2p.loginAction;

import java.util.List;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.alibaba.fastjson.JSON;
import com.alibaba.dubbo.config.annotation.Reference;
import com.eascs.p2p.common.entity.AdminResourceEntity;
import com.eascs.p2p.common.service.IAdminResourceService;
import com.eascs.p2p.common.vo.ModelResult;
import com.eascs.site.view.ViewContext;
import com.eascs.tag.MenuTag;

@Controller
@RequestMapping("/act/resource")
public class ResourceController extends PermissionBaseMasterViewController {
	@Reference
	private IAdminResourceService iAdminResourceService;
	@Override
	public void preHandle() {
		super.preHandle();
		ViewContext.put(MenuTag.CURRENT_MENU_CODE, "admin");
	}
	@RequestMapping(value = "/list", method = RequestMethod.GET)
	public String list() {
		ModelResult<List<AdminResourceEntity>> modelResult = iAdminResourceService.selectResourcesList();
		List<AdminResourceEntity> list = modelResult.getModel();
		ViewContext.put("reso", JSON.toJSONString(list));
		return "/sys/resourceList";
	}
}
